home *** CD-ROM | disk | FTP | other *** search
- Path: news1.cris.com!news
- From: aubrey@concentric.net (Aubrey Harrison)
- Newsgroups: comp.lang.c
- Subject: Re: What to do when feof() is NOT feof()
- Date: 19 Feb 1996 13:26:09 GMT
- Organization: Concentric Internet Services
- Message-ID: <4g9tph$5ss@spectator.cris.com>
- References: <4g7rsj$fnf@spectator.cris.com> <1996Feb19.063026.29889@zcon.com>
- NNTP-Posting-Host: cnc022039.concentric.net
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.6
-
- In article <1996Feb19.063026.29889@zcon.com>, szh@zcon.com∞ says...
- [snip]
- >On my SunOS system, there is no such ascii 26 byte denoting end of file
- >and fgets will *not* terminate in this manner. The point is that by
- >making such incorrect responses (like you did by insisting on this
- >point) is just plain wrong. It has nothing to do with the language or
- >how the end of files are denoted in most operating systems. Even in
- >PC's running MSDOS, there is no such requirement that there *must* be
- >an ascii 26 at the end of text files. Certain editors (Brief is an
- >example. microEMacs is another) can easily be configured to create such
- >ascii files without this byte.
- >
- >Note that even the EOF result returned (look in stdio.h) has nothing to
- >do with the actual byte at the end of the file.
- >
- >The bottom line still is: please do not offer answers if you do not
- >know the correct answer.
- >--
- >-------------------------------------------------------------------------
- >| Syed Zaeem Hosain P. O. Box 610097 (408) 441-7021 |
- >| Z Consulting Group San Jose, CA 95161 szh@zcon.com |
- >-------------------------------------------------------------------------
-
- Nowhere did I say a file had to end with an ascii 26. What I said (or I am
- trying to say), and this is true which is why I can't understand all this
- commotion... On an MS-DOS machine, using Microsoft C, if you do not tell fopen
- you are reading a binary file by using the "rb" parameter inputs such as fgets
- will stop reading and return end-of-file if it encounters an ascii 26 in the
- file. i.e. If the 654th byte of a 60,000 line file is an ascii 26, fgets will
- only read 654 bytes of the file.
-
- Once again, the original message did not indicate what OS or compiler the
- person was using. I should have been clearer in my response that I was
- referring to MS-DOS and Microsoft C. I only responded because I have had the
- exact same problem and tracked it down to the fact that while the file I was
- reading was a "text" file there were a few bytes (including ascii 26) that were
- killing fgets and signalling end-of-file when it was not. Maybe he has some
- other problem, maybe he has the same problem. I don't know, and you don't know.
- I think the notion that the only help that could or should ever be given is an
- exact diagnoses and cure to a problem is a little ridiculous and unpractical.
-
- --
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Aubrey Harrison aubrey@concentric.net 75320.1606@compuserve.com
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Loneliness is to endure the presence of one who does not understand.
- -Elbert Hubbard (1856-1915)
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-